package com.saikuo.service.controller;

import com.saikuo.service.api.ApiResultModel;
import com.saikuo.service.service.ISearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by work on 2016/10/25.
 */
@Api(value = "搜索接口", description = "搜索药品")
@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private ISearchService searchService;

    @ApiOperation(value = "搜索药品")
    @RequestMapping(value = "/search/medicine", method = RequestMethod.GET)
    public ApiResultModel search(@RequestParam String searchTxt,
                                 @RequestParam int from) {
        return new ApiResultModel(searchService.searchMedicine(searchTxt,from));
    }
}
